Skip to content

Support _keepTypedInAdditionalProperties for UsageSummary models#4427

Open
charlie-zhang109 wants to merge 4 commits into
masterfrom
czhang/typed-fields-in-additional-properties
Open

Support _keepTypedInAdditionalProperties for UsageSummary models#4427
charlie-zhang109 wants to merge 4 commits into
masterfrom
czhang/typed-fields-in-additional-properties

Conversation

@charlie-zhang109

Copy link
Copy Markdown

What does this PR do?

Adds static readonly _keepTypedInAdditionalProperties = true to UsageSummaryDate, UsageSummaryDateOrg, and UsageSummaryResponse (the spec flag comes from DataDog/datadog-api-spec#5941).

Updates ObjectSerializer.ts (v1 + v2) to check this flag during deserialization: when set, ALL JSON keys (not just unknown ones) are included in extraAttributes and therefore in additionalProperties. Previously, only keys absent from attributesBaseNames reached that map.

Note: ObjectSerializer.ts is auto-generated. This PR patches the generated file directly to demonstrate the intended behavior; the upstream generator also needs to be updated to emit the keepAllInAdditional guard for flagged models so the change survives regeneration.

Companion PRs:

Review checklist

  • This PR includes all newly recorded cassettes for any modified tests.

  • This PR does not rely on API client schema changes.

    • The CI should be fully passing.
  • Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.

Add a static `_keepTypedInAdditionalProperties = true` flag to UsageSummaryDate,
UsageSummaryDateOrg, and UsageSummaryResponse. Update ObjectSerializer (v1 + v2)
to include typed keys in additionalProperties when a model sets this flag, giving
a single unified access pattern for all fields.

Note: ObjectSerializer is auto-generated; the upstream generator also needs
updating to emit the keepAllInAdditional guard for flagged models.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
charlie-zhang109

This comment was marked as resolved.

charlie-zhang109 and others added 2 commits June 8, 2026 10:11
… mode

When _keepTypedInAdditionalProperties is true, known typed attributes are now
deserialized with their declared type/format before being stored in
additionalProperties. This routes int64 fields through the BigInt conversion
path instead of raw JSON number assignment. Also removes the redundant
instance.additionalProperties initialization guard that was immediately
overwritten.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ibutesMap pass

Previously the keepAllInAdditional path rebuilt a baseNameToAttr reverse map
inside the conditional on every deserialization call. Hoisting it to a single
combined loop halves the attributesMap iterations per call for flagged models.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@datadog-prod-us1-6

datadog-prod-us1-6 Bot commented Jun 8, 2026

Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

Ensure labels | changelog   View in Datadog   GitHub Actions

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0be4339 | Docs | Datadog PR Page | Give us feedback!

charlie-zhang109

This comment was marked as resolved.

…ObjectSerializer

baseNameToAttr was conditionally set to null when keepAllInAdditional is false,
which fails under strict: true. Always initialize to {} and skip population via
the existing keepAllInAdditional guard in the loop body.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@charlie-zhang109 charlie-zhang109 marked this pull request as ready for review June 8, 2026 15:23
@charlie-zhang109 charlie-zhang109 requested review from a team as code owners June 8, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant